/*
 * Console.hpp
 *
 *  Created on: Jun 4, 2016
 *      Author: Yang
 */

#ifndef CONSOLE_HPP_
#define CONSOLE_HPP_

#include "FreeRTOS.h"
#include "task.h"

#include "HAL/HAL.hpp"

#define Console_Buff_LEN 150

#define Console_RxState_Clear \
do{\
    Console_RX.Len = 0;\
    Console_RX.State = uncomplete;\
    HAL_UART_Receive_DMA(&huart6, Console_RX.Data + Console_RX.Len, Console_Buff_LEN);  \
}while(0)
enum Console_State
{
    ready, uncomplete,
};
typedef struct Console_Rx_Data
{
    uint8_t Len;
    Console_State State;
    uint8_t Data[Console_Buff_LEN];
} Rx_Data;

extern Rx_Data Console_RX;
extern USART_DARIVER console;

void Console_Task_Init(void);
void Console_IRQ(void);

#endif /* CONSOLE_HPP_ */
